﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace HA.ModFlow.Controls.PresentationClass.DataSetValue
{
    class DataSetValueView
    {
        public DataSetValueView(int row, int col, int layer, double value,int ibound)
        {
            this.ColIndex = col;
            this.RowIndex = row;
            this.LayerIndex = layer;
            this.DataValue = value;
            this.Ibound = ibound;
        }
        public DataSetValueView()
        {
        }
        private int _layerIndex;
        /// <summary>
        /// 第N层
        /// </summary>
        public int LayerIndex
        {
            get { return _layerIndex; }
            set { _layerIndex = value; }
        }
        private int _rowIndex;
        /// <summary>
        /// 第N行
        /// </summary>
        public int RowIndex
        {
            get { return _rowIndex; }
            set { _rowIndex = value; }
        }
        private int _colIndex;
        /// <summary>
        /// 第N列
        /// </summary>
        public int ColIndex
        {
            get { return _colIndex; }
            set { _colIndex = value; }
        }
        private double _DataValue;
        /// <summary>
        /// 第N层N行N列的数值
        /// </summary>
        public double DataValue
        {
            get { return _DataValue; }
            set { _DataValue = value; }
        }

        private int _ibound;
        /// <summary>
        /// 边界
        /// </summary>
        public int Ibound
        {
            get { return _ibound; }
            set { _ibound = value; }
        }
        /// <summary>
        /// 把三维数组转化为Datagrid使用的数据
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        public List<DataSetValueView> GetDataSetValueView(double[, ,] data,List <int [,]>ibound)
        {
            List <DataSetValueView> dataValues=new List<DataSetValueView> ();
            for (int i = 0; i < data.GetLength(2); i++)
            {
                for (int j = 0; j < data.GetLength(0); j++)
                {
                    for (int k = 0; k < data.GetLength(1); k++)
                    {
                        dataValues.Add(new DataSetValueView(j + 1, k + 1, i + 1, data[j, k, i], ibound[i][ j, k]));
                    }
                }
            }
            return dataValues;
        }
    }
}
